package com.lzk.工厂模式.简单工厂.order;

import com.lzk.工厂模式.简单工厂.pizza.CheesePizza;
import com.lzk.工厂模式.简单工厂.pizza.GreekPizza;
import com.lzk.工厂模式.简单工厂.pizza.Pizza;

/**
 * author: 刘中魁
 */
public class SimpleFactory {

    //根据 orderType 返回对应的 Pizza对象
    public Pizza createPizza(String orderType){
        Pizza pizza = null;

        System.out.println("使用简单工厂模式");
        if (orderType.equals("xila")){
            pizza = new GreekPizza();
            pizza.setName("希腊披萨");

        }else if (orderType.equals("nailao")){
            pizza = new CheesePizza();
            pizza.setName("奶酪披萨");

        }else if (orderType.equals("china")){
            pizza = new CheesePizza();
            pizza.setName("中国披萨");
        }

        return pizza;

    }

}
